package com.mot.st.network.request

import com.gtxc.kotlinmvvm.network.request.*
import com.mot.st.network.api.ApiService
import com.mot.st.network.RetrofitClient
import retrofit2.http.GET
import java.net.IDN

/**
 *   @auther : Aleyn
 *   time   : 2019/11/01
 *   请求类
 */
class ApiNetWork {

    private val mService by lazy { RetrofitClient.getInstance().create(ApiService::class.java) }
    /*
    * 获取验证码
    * */
    suspend fun Postcode(phone: RequestTestBean) = mService.postcode(phone)
    /*
    * 注册
    * */
    suspend fun postRegister(registerBean:  RegisterBean) = mService.Register(registerBean)
    /*
    * 登录
    * */
    suspend fun postLogin(loinBean: LoinBean) = mService.Login(loinBean)
    /*
    * 忘记密码
    * */
    suspend fun postforget(forgetBean: ForgetBean) = mService.postforget(forgetBean)
    /*
    * 首页数据
    * */
    suspend fun gethomepage() = mService.gethomepage()
    /*
    * app版本检测
    * */
    suspend fun getverifyNewVersion(verifyNewVersionBean: verifyNewVersionBean) = mService.verifyNewVersion(verifyNewVersionBean)
    /*
    * 通过版本code查询版本信息
    * */
    suspend fun getVersion(verifyNewVersionBean: verifyNewVersionBean) = mService.getVersion(verifyNewVersionBean)
    /*
    * 闪电图标每日任务接口
    * */
    suspend fun basicsTaskConmit() = mService.basicsTaskConmit()
    /*
    * 首个节点查询
    * */
    suspend fun getfirstNode() = mService.getfirstNode()
    /*
    * 新闻资讯
    * */
    suspend fun gettitle() = mService.gettitle()

    /*
    *    闪电图标每日任务接口
    * */


    companion object {
        @Volatile
        private var netWork: ApiNetWork? = null
        fun getInstance() = netWork ?: synchronized(this) {
            netWork ?: ApiNetWork().also {
                netWork = it }
        }
    }

}